// index.js
Page({
  /**
   * 页面的初始数据
   */
  data: {
    markers:{},
    longitude:"",//用户经度
    latitude:"",//用户纬度
      barHeight: 20, //  顶部状态栏高度
      navBarHeight: 66, // 顶部高度
      viewHeight: 640, // 默认高度
      current: 0,
      images: [
        '/img/1.png','/img/2.png','/img/3.png'
      ]
      ,
      tabList: [{
              id: '1',
              src: '/img/huafei.png',
              title: '充值缴费',
              link: '/pages/recharge/recharge'
          },
          {
              id: '2',
              src: '/img/jifen.png',
              title: '积分抽奖',
              link: '/pages/pointsMall/mall'
          },
          {
              id: '3',
              src: '/img/kefu.png',
              title: '客服咨询',
              link: '/pages/chat/chat'
          },
      ],
      photo:[
        {
          id: '1',
          src: '/img/Xiaomi MIX Fold3.png',
          title: 'Xiaomi MIX Fold3',
          link: '/pages/pointsmallAll/mall'
        },
        {
          id: '2',
          src: '/img/youhui.png',
          title: '优惠券',
          link: '/pages/pointsmallAll/mall'
        },
        {
          id: '3',
          src: '/img/diannao.png',
          title: '拯救者Y9000P',
          link: '/pages/pointsmallAll/mall'
        }
      ]
  },
  bindchange(e) {
      this.setData({
          current: e.detail.current
      })
  },
  imageClicked: function (event) {
    const url = event.currentTarget.dataset.url;
    wx.navigateTo({
      url: url
    });
    console.log(url)
  },
  imageClicked1: function (event) {
    const url = event.currentTarget.dataset.url;
    wx.navigateTo({
      url: url
    });
    console.log(url)
  },
  qiandao(){
    wx.navigateTo({
      url: '/pages/qiandao/qiandao'
    });
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {
      var that = this;
      // 胶囊信息
      var menu = wx.getMenuButtonBoundingClientRect();
      wx.getSystemInfo({
          success(res) {
              that.setData({
                  barHeight: res.statusBarHeight,
                  navBarHeight: menu.top + menu.height + 6,
                  viewHeight: res.windowHeight
              })
          }
      })
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    wx.getLocation({
      type: 'gcj02',
      isHighAccuracy:true,
      altitude:true,
      success: (res)=> {
        this.setData({
          longitude:res.longitude,
          latitude:res.latitude,
          markers: [{
            id: 1,
            longitude: res.longitude,
            latitude:res.latitude,
            title: "当前位置",
            iconPath: '/img/location.png', // 你可以使用自己的图标路径
            width: 100,
            height: 100
          }]
        })
        console.log(res);
      }
     })
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})
